import { defAxios as request } from '@/utils/http'

/**
 * 任务 分页查询
 * @returns
 */
export const getTaskList = params => request({
  url: '/inspection/page/list',
  method: 'GET',
  params
})

/**
 * 任务详情
 * @param {*} params id
 * @returns
 */
export const getTaskDetail = params => request({
  url: `/inspection/details/${params}`,
  method: 'GET'
})

/**
 * 根据id查询任务
 * @param {*} params id
 * @returns
 */
export const getTaskByID = params => request({
  url: `/inspection/info/${params}`,
  method: 'GET'
})

/**
 * 添加任务
 * @param {*} params
 * @returns
 */
export const taskAdd = data => request({
  url: '/inspection/add',
  method: 'POST',
  data
})

/**
 * 编辑任务(重新提交)
 * @param {*} params
 * @returns
 */
export const taskEdit = data => request({
  url: '/inspection/resubmit',
  method: 'PUT',
  data
})

/**
 * 编辑任务(编辑)
 * @param {*} params
 * @returns
 */
export const taskEditNew = data => request({
  url: '/inspection/edit',
  method: 'PUT',
  data
})

/**
 * 删除任务
 * @param {*} params
 * @returns
 */
export const taskDel = params => request({
  url: `/inspection/delete/${params}`,
  method: 'DELETE'
})

/**
 * 任务 巡检机场列表
 * @returns
 */
export const getAirList = params => request({
  url: '/airport/list',
  method: 'GET',
  params
})
/**
 * 根据机场id选择的任务
 * @param {*} params id
 * @returns
 */
export const getAirTask = params => request({
  url: `/inspection/listByAirportId?airportId=${params}`,
  method: 'GET'
})
/**
 * 根据任务id选择视频
 * @param {*} params id
 * @returns
 */
export const getTaskVideo = params => request({
  url: `/inspection/videoById/${params}`,
  method: 'GET'
})

/**
 * 任务 巡检路线列表
 * @returns
 */
export const getWayList = params => request({
  url: `/airport/line/list/${params}`,
  method: 'GET'
})

/**
 * 任务 直播URL
 * @returns
 */
export const getLiveUrl = params => request({
  url: `/inspection/videoById/${params}`,
  method: 'GET'
})

/**
 * 任务 立即执行（等接口）
 * @returns
 */
export const toDoing = params => request({
  url: `/inspection/execute/${params}`,
  method: 'POST'
})

/**
 * 任务 问题分页列表
 * @returns
 */
export const getTaskInspection = params => request({
  url: '/inspectionFile/page/list/by/inspectionid',
  method: 'GET',
  params
})

/**
 * 任务 问题类型列表
 * @returns
 */
export const getTaskInspectionType = params => request({
  url: '/question/type/list',
  method: 'GET',
  params
})

/**
 * 任务 问题确认
 * @param {*} params
 * @returns
 */
export const inspectionConfirm = data => request({
  url: '/inspectionFile/confirm/' + data,
  method: 'POST'
})

/**
 * 任务 问题忽略
 * @param {*} params
 * @returns
 */
export const inspectionIgnore = data => request({
  url: '/inspectionFile/ignore/' + data,
  method: 'POST'
})

/**
 * 根据无人机id获取航线信息
 * @param {*} params
 * @returns
 */
export const getLineList = params => request({
  url: `/airport/line/list/${params}`,
  method: 'GET'
})

/**
 * 新增航线
 * @param {*} params
 * @returns
 */
export const addAirportLine = data => request({
  url: `/airportLine/add`,
  method: 'POST',
  data
})

/**
 * 根据机场id获取航线列表
 * @param {*} params
 * @returns
 */
export const getAirLineByAir = params => request({
  url: `/airportLine/list/byAirportId/${params}`,
  method: 'GET'
})
